//
//  ChainAccountSetCell.m
//  Chain
//
//  Created by zhaosh on 2018/4/12.
//  Copyright © 2018年 zhaosh. All rights reserved.
//

#import "ChainAccountSetCell.h"

@interface ChainAccountSetCell()
@property (nonatomic,strong) UILabel *titleNameLb;
@property (nonatomic,strong) UILabel *valueNumLb;
@property (nonatomic,strong) UIView *aboveView;
@property (nonatomic,strong) UIView *grayLb;
@end

@implementation ChainAccountSetCell
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *identifier = @"ChainAccountSetCell";
    ChainAccountSetCell *cell = (ChainAccountSetCell*)[tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil){
        cell = [[ChainAccountSetCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
    }
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor clearColor];
        [self setContentView];
    }
    return self;
}

- (void)setContentView{
    self.aboveView = [[UIView alloc]init];
    self.aboveView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.aboveView];
    
    self.titleNameLb = [[UILabel alloc]init];
    self.titleNameLb.textAlignment = NSTextAlignmentLeft;
    self.titleNameLb.textColor = [UIColor colorWithHexString:@"#333333"];
    self.titleNameLb.font =[UIFont systemFontOfSize:16.0];
    [self.aboveView addSubview:self.titleNameLb];
    
    self.valueNumLb = [[UILabel alloc]init];
    self.valueNumLb.textAlignment = NSTextAlignmentLeft;
    self.valueNumLb.textColor = [UIColor colorWithHexString:@"#999999"];
    self.valueNumLb.font =[UIFont systemFontOfSize:16.0];
    self.valueNumLb.textAlignment =NSTextAlignmentCenter;
    [self.aboveView addSubview:self.valueNumLb];
    
    self.grayLb = [[UIView alloc]init];
    self.grayLb.backgroundColor = FINELINECOLOR;
    [self.aboveView addSubview:self.grayLb];
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.aboveView.frame = CGRectMake(0, 0, ScreenWidth, self.height);
    self.titleNameLb.frame =CGRectMake(30, 20, 200, 20);
    
    if ([self.item.tileName isEqualToString:@"系统缓存"]) {
        self.valueNumLb.frame =CGRectMake(self.width-105, 22, 80, 20);
    }else if ([self.item.tileName isEqualToString:@"系统版本"]){
        self.valueNumLb.frame =CGRectMake(self.width-85, 22, 80, 20);
    }
    self.grayLb.frame = CGRectMake(0, self.height - 0.5, self.aboveView.width, 0.5);
    
    self.titleNameLb.text=self.item.tileName;
    self.valueNumLb.text =self.item.valueNum;
}
@end
